package itheima.moc.myreflect5;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ReflectDemo2 {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
        Class clazz = Class.forName("itheima.moc.myreflect5.Student");
        Method method = clazz.getMethod("fun4", String.class);
        Student student = (Student) clazz.newInstance();
        Object result = method.invoke(student, "xu");
        System.out.println(result);
    }
}
